#pragma once


class CFrameVectorBuffer;
class CLayer;
class CMILMatrix;
class CBandVectorBuffer;
class CBrush;
class CEdge;
class CEdgeStore;

class CRasterizerEdgeStore
{

private: 
	XUINT32 m_uOpacity;
	enum XcpFillMode m_fillMode;
	XINT32 m_xOffset;
	XINT32 m_yOffset;
	CRasterizerEdgeStore * m_pNext;
	CRasterizerEdgeStore * * m_ppPrevious;
	XUINT32 m_dwDrawOrder;
	struct RasterizerData * m_pRasterizerData;
	CFrameVectorBuffer * m_pVecBufferOwner;


	XUINT32 m_cRefs:0x1b;
	XBOOL m_fDrawnLastFrame:1;
	XBOOL m_fLeavingFrame:1;
	XBOOL m_fSplitPath:1;
	XUINT32 m_shapeMaskMode:2;
protected: 
	CEdgeStore * m_pEdgeStore;
	struct IBrushSpan * m_pBrushSpan;
	CLayer * m_pLayer;
	virtual ~CRasterizerEdgeStore();

public: 
	CRasterizerEdgeStore();
	XUINT32 AddRef();
	XUINT32 Release();
	static CRasterizerEdgeStore * ReverseLinkedList(CRasterizerEdgeStore * pList);
	static void AssertInOrder(CRasterizerEdgeStore * pList);
	void SetRasterizerData(struct RasterizerData * pData);
	void SetEdgeStore(CEdgeStore * pEdgeStore);
	void SetFillMode(enum XcpFillMode fillMode);
	void SetOwningVectorBuffer(CFrameVectorBuffer * pVectorBuffer);
	XINT32 SubpixelTop();
	XINT32 SubpixelBottom();
	XINT32 SubpixelLeft();
	XINT32 SubpixelRight();
	XINT32 EdgeCount();
	CEdge * Edges();
	CEdgeStore * EdgeStore();
	XINT32 SubpixelXOffset();
	XINT32 SubpixelYOffset();
	XBOOL IsInvisible();
	struct IBrushSpan * Brush();
	CRasterizerEdgeStore * Next();
	XUINT32 DrawOrder();
	CLayer * Layer();
	struct RasterizerData * GetRasterizerData();
	enum XcpFillMode FillMode();
	XUINT32 Opacity();
	XBOOL IsDrawDirty();
	XBOOL IsLeaving();
	XBOOL IsSplitPath();
	XUINT32 IsGlyphBitmap();
	struct IPALGlyphBitmap * GlyphBitmap();
	void SetShapeMaskMode(enum XcpShapeMaskMode shapeMaskMode);
	enum XcpShapeMaskMode GetShapeMaskMode();
	CFrameVectorBuffer * OwningVectorBuffer();
	void SetDrawn(XBOOL fDrawn);
	void SetLeavingFrame(XBOOL fLeavingFrame);
	void SetSplitPath(XBOOL fSplitPath);
	void InsertAt(CRasterizerEdgeStore * * ppHead, XUINT32 dwDrawOrder);
	void AppendAt(CRasterizerEdgeStore *, XUINT32);
	void Unlink();
	static HRESULT MergeLists(CRasterizerEdgeStore * pPrevious, CRasterizerEdgeStore * * ppNew, XINT32 nSubpixelTop, XINT32 nSubpixelOffsetX, CBandVectorBuffer * pFrameVectorBuffer, XINT32 * pnStartXDirty, XUINT32 * pcDirtyPixels);
	HRESULT Clone(CRasterizerEdgeStore * * ppClone);
	void SetBrushSpan(struct IBrushSpan * pBrushSpan);
	virtual void NWSetBrushSpan(struct IBrushSpan * pBrushSpan);
	HRESULT SetBrush(CBrush * pBrush, const CMILMatrix * pTransform, const struct XRECTF_WH * pLocalBounds);
	HRESULT SetBrush(CBrush * pBrush, const CMILMatrix * pTransform, XUINT32 pLocalBounds);
	static HRESULT CheckNewTransform(CRasterizerEdgeStore * * ppStore, const CMILMatrix * pMatrix, XBOOL fPrimaryBuffer, XINT32 width, XINT32 height, XBOOL & fIsInside);
	virtual void SetOffset(const CMILMatrix * pMatrix);
	virtual void SetOffset(struct XPOINTF * pMatrix);
	void SetRendering(CLayer * pLayer, XBOOL fCopyBounds);

	void SetRendering(XFLOAT rOpacity, CLayer * pLayer, XBOOL fCopyBounds);
	HRESULT SetLayer(CLayer *, CLayer *);
	void GetBoundingRectangle(struct XRECTF_WH * pRect);
	void GetLocalBounds(struct XRECTF_WH *);
	void ComputeRenderedBounds(struct XRECT_RB & rcBounds);
	XUINT32 DoesIntersectWithPolygon(XUINT32, struct XPOINTF *);
	void UpdateTargetLayerBounds();
	void SetFillModeAccountingForClip(enum XcpFillMode fillMode, XBOOL fHasPen);



};


